module.exports = {
  // 输出文件目录
  outputDir: 'dist', // 默认dist
  chainWebpack: (config) => {
    // 添加分析工具
    if (process.env.NODE_ENV === 'production') {
    if(process.env.npm_config_report){
      config
      .plugin('webpack-bundle-analyzer')
      .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
      .end()
      config.plugins.delete('prefetch')
    }
  }
  },
  // css相关配置
  css: {
    extract: true,
    sourceMap: false,
    loaderOptions: {
      css: {},
      postcss: {
        plugins: [
          require('postcss-px2rem')({
            remUnit: 37.5
          })
        ]
      }
    }
  },
  devServer: {
    host: '0.0.0.0',
    port: 8080,
    https: false,
    open: true,
    hotOnly: false,
  }
}